<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:composition     xmlns="http://www.w3.org/1999/xhtml"
                    xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:ice="http://www.icesoft.com/icefaces/component"
                    xmlns:f="http://java.sun.com/jsf/core"
                    xmlns:odr="http://java.sun.com/jsf/composite/odr">


    <div class="formSection">
        <ice:outputLabel value="#{form['label.state']}" for="inState"/>
        <ice:outputText value="#{form['constraint.required']}" styleClass="required" />
        <ice:selectOneMenu id="inState"
                           label="#{form['label.state']}"
                           required="true"
                           value="#{manageDecisionController.statesStep.state}"
                           onchange="j('#stateChangeInformation').slideDown();">
            <f:selectItems value="#{manageDecisionController.statesStep.states}" />
        </ice:selectOneMenu>

        <odr:informationWidget id="stateChangeInformation"
                               text="#{form['decision.wizard.state.change.information']}"
                               visible="false"/>

        <p class="empty increasedPadding" />
    </div>

    <odr:datetimepicker value="#{manageDecisionController.statesStep.decidedWhen}" 
                            idLabel="decisionDateStatesStep"
                            dateLabel="#{form['label.decided.when']}"
                            timeLabel="#{form['label.time']}"/>

    <div class="formSection last">
        <ice:outputLabel value="#{form['label.initiators']}" for="inInitiators"/>
        <ice:outputText value="#{form['constraint.required']}" styleClass="required" />
        <ice:selectOneMenu id="inInitiators"
                           label="#{form['label.initiators']}"
                           immediate="true"
                           partialSubmit="true"
                           styleClass="add"
                           value="#{manageDecisionController.statesStep.selectedInitiator}">
            <f:selectItem itemLabel="#{form['label.pleaseSelect']}" noSelectionOption="true"/>
            <f:selectItems value="#{manageDecisionController.statesStep.availableInitiators}" />
        </ice:selectOneMenu>

        <ice:commandButton action="#{manageDecisionController.statesStep.addInitiator}"
                           value="#{form['button.add']}"
                           styleClass="add"
                           partialSubmit="true"
                           immediate="true"
                           id="manageDecisionInitiatorAddButton"/>

        <ice:dataTable value="#{manageDecisionController.statesStep.initiators}" var="item"
                       styleClass="collection"
                       style="margin-left: 100px; padding-top: 15px;">
            <ice:column>
                <ice:outputText value="#{item.person.name}" nospan="true"/>
                <span>&lt;<ice:outputText value="#{item.person.email}" nospan="true"/>&gt;</span>
            </ice:column>
            <ice:column styleClass="navigationColumn">
                <ice:commandLink value=""
                                 action="#{manageDecisionController.statesStep.removeInitiator(item.id)}"
                                 immediate="true"
                                 styleClass="columnNavigationLink">
                    <img alt="#{common.remove}"
                         src="resources/images/removeSmall.png"
                         width="14"
                         height="14"/>
                </ice:commandLink>
            </ice:column>
        </ice:dataTable>

        <p />
    </div>

</ui:composition>
